Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

Bug: Cannot Clear Radio Button List Selection

Description

Normally, setting a field’s rawValue property to null essentially clears its value. It should follow that setting a radio button list’s rawValue property would clear its selection (i.e. if one of its radio buttons was selected, none would be selected when its value is set to null).

To clear a text field, for example, you would do the following:

MyTextField.rawValue = null;

To clear a radio button list, the following should also work:

MyRadioButtonList.rawValue = null;

The issue is that the above statement for clearing a radio button list doesn’t work: The selection remains and the radio button list’s rawValue property remains set to the value of the selected radio button.

Workaround

There are two workarounds to this issue. The first consists of clearing the data node associated with the radio button list, provided the radio button list is bound to data (which means the “Object palette > Binding tab > Default Binding property” is set to something other than “None”):

MyRadioButtonList.dataNode.isNull = 1;

Note that if you attempt to use this workaround when the radio button list is not bound to data, an error will occur because its dataNode property will be null and you’ll attempt to access the isNull property of a null object.

The second workaround consists of using the xfa.host.resetData() method to clear the radio button list:

xfa.host.resetData(MyRadioButtonList.somExpression);

The advantage of the second workaround is that it will work regardless of whether the radio button list has a data binding or not.

Fix

Please refer to the Bug List for updated information on the version(s) affected by this bug as well as if and when it was/will be fixed.


Posted by Stefan Cameron on October 9th, 2008
Filed under Acrobat,Bugs,Scripting,XFA
Both comments and pings are currently closed.

6 Responses to “Bug: Cannot Clear Radio Button List Selection”

  1. Michal Hraba on October 14th, 2008

    Hi Stefan,

    it is possible to use a script
    MyRadioButtonList.rawValue = ”;

    Michal

  2. Rick Kuhlmann on October 17th, 2008

    Use the following script to clear exclusion groups:

    RadioButtonGroup.rawValue = “”;

    Rick Kuhlmann
    Tech-Pro, Inc.

  3. hardik on September 18th, 2009

    Clear Radiobutton List Use This I clearly help you

    radiobuttonlist.SelectedItem.Selected = false

  4. Todd on February 12th, 2010

    Hi Stefan,

    I like you blog, I am on here all the time trying to learn new things.

    Instead of clearing the radio buttons how do you get it so you can select multiple buttons? I tried using the script you have and make changes but its not working, can you please help?

    Thank You
    Todd

  5. Stefan Cameron on February 22nd, 2010

    Todd,

    If you want users to select multiple buttons, you’ll need to use checkboxes instead of radio buttons. Radio buttons are, by definition, mutually-exclusive (you may only select one amongst the entire group).

  6. John C Cummins on August 6th, 2010

    Great tip that helped me on a form I was designing. Definitely saved me some time.